From 158165f769c6eaee7209b0bd84d480c000d64e07 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 28 Feb 2023 13:52:12 -0300 Subject: [PATCH] filethumbnail: Clear image on failure Unset the image if we fail to find the appropriate icon, regardless of the reason of the failure. Prevents the thumbnail to misrepresent the GFileInfo it's supposed to represent. --- gtk/gtkfilethumbnail.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gtk/gtkfilethumbnail.c b/gtk/gtkfilethumbnail.c index 3203589027..3e01484158 100644 --- a/gtk/gtkfilethumbnail.c +++ b/gtk/gtkfilethumbnail.c @@ -78,7 +78,10 @@ update_image (GtkFileThumbnail *self) int scale; if (!g_file_info_has_attribute (self->info, G_FILE_ATTRIBUTE_STANDARD_ICON)) - return FALSE; + { + gtk_image_clear (GTK_IMAGE (self->image)); + return FALSE; + } scale = gtk_widget_get_scale_factor (GTK_WIDGET (self)); icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (self))); @@ -128,7 +131,10 @@ static void get_thumbnail (GtkFileThumbnail *self) { if (!self->info) - return; + { + gtk_image_clear (GTK_IMAGE (self->image)); + return; + } if (!update_image (self)) { -- 2.30.2